#
# Copyright 2009 Jeffrey Palm
#

# Instances of this class expose both the HasASharedKey interface as
# well as the the KeyFinder interface.  So we do that by composition
# and have one of each.
class HasASharedKeyAndFindsKeys < KeyFinder,HasASharedKey
  
  attr_reader :key_finder
  attr_reader :has_a_shared_key

  def initialize(key_finder,has_a_shared_key)
    @key_finder       = key_finder
    @has_a_shared_key = has_a_shared_key
  end

  # ----------------------------------------------------------------------
  # KeyFinder
  # ----------------------------------------------------------------------

  def find_the_key
    @key_finder.find_the_key
  end

  # ----------------------------------------------------------------------
  # HasASharedKey
  # ----------------------------------------------------------------------

  def shared_key
    @has_a_shared_key.shared_key
  end

  def shared_key=(val)
    @has_a_shared_key.shared_key = val
  end

end
